package maze.model.type;

public enum Face
{
	EAST(0), // east
	SOUTH(1), // south
	WEST(2), // west
	NORTH(3);// north

	private int value;

	private Face(int value)
	{
		this.value = value;
	}

	public int getValue()
	{
		return value;
	}

	public Face opposite()
	{
		if (this == EAST)
			return WEST;
		else if (this == SOUTH)
			return NORTH;
		else if (this == WEST)
			return EAST;
		else if (this == NORTH)
			return SOUTH;
		else
			return null;
	}

	public Face next()
	{
		if (this == EAST)
			return SOUTH;
		else if (this == SOUTH)
			return WEST;
		else if (this == WEST)
			return NORTH;
		else if (this == NORTH)
			return EAST;
		else
			return null;
	}

	public static Face getFace(int value)
	{
		for (Face face : values())
		{
			if (face.value == value)
			{
				return face;
			}
		}
		return null;
	}
}
